package jp.co.technotree.common.dao;

import java.util.ArrayDeque;

public class TransactionStack {
	public ArrayDeque<Transaction> dequeue = new ArrayDeque<Transaction>();
	
	public void push(Transaction trx){
		dequeue.addLast(trx);
		//System.out.println("stack push:"+dequeue.size());
	}
	
	public Transaction pop(){
		if ( dequeue.size() == 0 ) return null;
		Transaction trx = dequeue.getLast();
		dequeue.removeLast();
		
		//System.out.println("stack pop:"+dequeue.size());
		return trx;
	}
	
	public Transaction peek(){
		if ( dequeue.size() == 0 ) return null;
		Transaction trx = dequeue.getLast();
		
		//System.out.println("stack peek:"+dequeue.size());
		return trx;
	}
	
	public int size(){
		return dequeue.size();
	}
	
}
